package com.muy.redis.view.component;

import com.intellij.openapi.project.Project;
import com.intellij.util.ui.JBUI;
import com.muy.redis.common.tree.AbstractMTTreePanel;

import javax.swing.*;

/**
 * @Author jiyanghuang
 * @Date 2022/8/7 13:50
 */
public abstract class AbstractLRContent<L extends AbstractMTTreePanel, R extends TabContentRightShow> extends JSplitPane {

    private final Project project;

    private static final double WINDOW_WEIGHT = 0.17D;

    protected L l;

    protected R r;

    public AbstractLRContent(Project project, L l, R r) {
        super(HORIZONTAL_SPLIT);
        this.project = project;
        this.l = l;
        this.r = r;

        // JSplitPane 分割窗口参数
        setContinuousLayout(true);
        setResizeWeight(WINDOW_WEIGHT);
        // 如果设置为0则无法再移动
        setDividerSize(1);
        setBorder(JBUI.Borders.empty());

        setLeftComponent(this.l);
        setRightComponent(this.r);
    }
}
